package demo1;

import java.util.*;

//牛客网:chika和蜜柑

// 注意类名必须为 demo1.Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        Integer[][] a = new Integer[n][2];
        for (int i = 0; i < n; i++) {
            a[i][0] = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            a[i][1] = in.nextInt();
        }
        Arrays.sort(a, new Comparator<Integer[]>() {
            @Override
            public int compare(Integer[] o1, Integer[] o2) {
                if (o1[1] != o2[1]) {
                    return o2[1] - o1[1];
                } else {
                    return o1[0] - o2[0];
                }
            }
        });

        long ret1 = 0, ret2 = 0;

        for (int i = 0; i < k; i++) {
            ret1 += a[i][0];
            ret2 += a[i][1];
        }
        System.out.println(ret1 + " " + ret2);
    }
}